home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
gg_m103.zip
/
M.TUT
< prev
next >
Wrap
Text File
|
1994-04-06
|
47KB
|
918 lines
The M Tutorial File
You may ask why this editor is called M... It is called M because it is My
editor... the editor I wrote, Mine. It can be your editor too.
In this file I will walk you through the features of M. To walk around in
this text, use the arrow keys, [pageUp], and [pageDown]. They behave like
you would expect them to... As a preliminary, I'll explain notation.
Characters in square brackets are M commands... (This is to set them off
from the rest of the text.) The Alternate and Control keys are used like
the shift key. In this tutorial I'll abreviate Control by a caret "^" and
Alternate by "Alt".
For example:
[^X] is Control_X
[Alt G 2] is Alt_G and then 2.
[^X ^F] is Control_X Control_F
[Alt ^M] is Alt_Control_M
In the event you want to EXIT right away... there are two principal ways to
exit M... The first is the exit without saving [^X ^C], if there are no
modified files you will be out. If there are modified files you will be
told of that fact and asked if you want to save them. If yes, you will be
asked about each file on your way out. ([Escape] and [^G] will abort the
exit.) The second exit method is the save all files and exit [Alt Z].
(The mnemonic is that Z is the last letter in the alphabet, [Alt Z] is the
last thing you type before leaving.)
I begin with an introductory note on the general theory of M. In M
there are windows and buffers (buffers = files). A window is a view into a
buffer and is only loosely connected to a buffer. You can switch the
buffer a window is connected to very easily. You can have many more
buffers open than you have windows to view them. You can also have many
windows open on the same buffer. All combinations are possible. Every
window has a StatusLine with sundry information about the current buffer.
Every window has a current cursor position (although only the active window
has a visible cursor). Every window has a mark. The mark is an old cursor
position used in block delete and block copys. (Occasionally I may refer
to the cursor as the point, I use the terms point and cursor
interchangeably.) The actual location of the cursor is between letters...
The cursor visible on the screen is underneath a letter, the real cursor
location is just in front of that character.
The [Escape] is not treated like other keys in M, typing an
[Escape] prior to another key is equivalent to holding down Alt while
typing that key. You can think of the letters you type as a stream of
characters coming to the program. When you type an [Alt Z] for example I
stick into the character stream first an [Escape] and then a [Z]... You
can just as easily type an [Escape] and then a [Z] yourself... (In some
contexts I peek if there is a character behind the [Escape]... If there
isn't one I know that you have typed a lone [Escape] and not a Alt key
combination. In some situations I interpret a lone [Escape] as an
abort...)
When a new command is described in this text, try it! If that command is
destructive add some garbage text to play with...
For those who are familiar with emacs, M's command structure is very
similar to that. Most common emacs commands are supported with the key
strokes you are used to.
Cursor Motion:
The arrow keys, [pageUp] and [pageDown] keys move like you expect
them... The analogous emacs move cursor commands [^F] forward, [^B]
backward, [^P] up, [^N] down, [Alt V] pageUp and [^V] pageDown keys are
supported. The [Home] and [End] keys work slightly differently than
expected... When you first type [Home] the cursor moves to the front of
the line, the second time it moves to the top of the page, the third time
to the top of the file. The [End] key works similarly.
The emacs commands [^A] front of line, [^E] end of line [Alt <] top of
file, [Alt >] end of file also work.
[^RightArrow] moves right by one word (same as [Alt F]).
[^LeftArrow] moves left by one word (same as [Alt B]).
[^UpArrow] moves up by paragraphs (in Cmode a paragraph is a curly brace).
[^DownArrow] moves down by paragraphs (in Cmode a paragraph is a curly brace).
Notice as you move the cursor the 2 numbers on the StatusLine following the
buffer name change... they are the line number and the column number. You
can move to a particular line using the goto command [Alt G (number)
Enter]. (You can abort this dialog with an [Escape] or a [^G]; [^G] is
the all purpose abort.)
The last of the simple cursor movement commands is the exchange cursor and
mark command [^X .]. Prior to executing this it is useful to set a mark to
a particular location. Both [Alt Spacebar] and [^Spacebar] set the mark
to the current cursor position. Try setting a mark and switching the mark
and the cursor.
As a final suggestion, I like it better when the cursor moves quickly... I
use the dos mode command in my autoexec.bat to do this for me. In my
autoexec I have:
mode con rate=32, delay=1
Deleting and Copying:
M has a killBuffer that it stores things in. It uses the
killBuffer as a clipboard for block copys and pastes. There are a number
of ways to put text into the killBuffer. The first way is to copy a block
into it. Set a mark [Alt Spacebar] (or [^Spacebar]), move the cursor to a
new position, and do an alt wipe [Alt W]. The text between the mark and
the cursor has been copied into the killBuffer. Next move the cursor to an
empty line and do a Yank [^Y]. Do another Yank, and another... You now
have multiple copies of the text.
Another way to get text into the killBuffer is to do a control
wipe. Like the last time, set a mark [Alt Spacebar] or [^Spacebar], move
the cursor, and Wipe [^W]. This Wipe deletes the text while moving it into
the killBuffer. The deleted text can now be yanked anywhere you want it.
There are more methods of putting text into the killBuffer. You
can kill individual lines with [Alt K] and [^K]. [^K] kills from the
cursor to the end of the line. [Alt K] kills the whole line irrespective
of where the cursor is in the line. If one kill command directly follows
another, instead of throwing out the old killBuffer and replacing it with
the new kill, the killBuffer appends the new kill to the existing
killBuffer. Try killing a whole bunch of lines in a row and yanking them
all back in one yank.
There are a few more ways to wipe text into the killBuffer, you can
kill by words. The [^Backspace] and the [^Delete] are word delete left and
word delete right. Again multiple consecutive kills append into the
killBuffer.
Finally there are some word copys into the killBuffer, [Alt
Backspace] and [Alt Delete]. Multiple consecutive copys append into the
killBuffer. Notice the control commands [^W] [^Backspace] and [^Delete]
are kills while the alt commands [Alt W] [Alt Backspace] and [Alt Delete]
are copys.
There is also Column deletes and yanks... To do a column wipe, set
a column mark [ALT ^spacebar]. Move the cursor to the other corner of the
rectangular block you are interested in. Either [Alt W] (copy) or [^W]
(delete) the column into the kill buffer.
The column Yank [ALT ^Y] yanks the contents of the kill buffer in a
column way at the cursor. You can do a column yank of the kill buffer
irrespective of how the the kill buffer was loaded (you did not have to
fill it with a column wipe). You could have done normal [Alt K] kills to
load it. When you column yank, the kill buffer is searched for the longest
line and all the other lines in it are padded with spaces to that length.
A rectangular piece of text is inserted at the cursor.
There is one more yank feature, the yankPop [Alt Y]. It is easiest
to describe what it does by actually doing it. Move to the line of 1's and
do an [Alt K] immediately followed by a [^Y], do the same thing on the line
of 2's, next on the 3's, and finally on the 4's. Now we are in a position
to show off the yankPop. Move the cursor to a blank line and yankPop [Alt
Y]. And [Alt Y] again and again and again... There is really a ring of 4
different killBuffers. When you ki